define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'weixin.user_card/index',
        add_url: 'weixin.user_card/add',
        edit_url: 'weixin.user_card/edit',
        delete_url: 'weixin.user_card/delete',
        export_url: 'weixin.user_card/export',
        modify_url: 'weixin.user_card/modify',
        success_url:'weixin.user_card/successInfo',
        error_url:'weixin.user_card/errorInfo'
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh','delete', 'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'realName', title: '申请用户名',minWidth:180},
                    {field: 'mobile', title: '手机号',minWidth: 120},
                    {field: 'birthday', title: '生日',minWidth: 120,templet: ea.table.date,format:'yyyy-MM-dd'},
                    {field: 'wechat.avatarUrl', title: '用户头像', templet: ea.table.image},
                    {field: 'wechat.nickName', title: '用户昵称'},
                    {field: 'create_time', title: '创建时间',width:180},
                    {field: 'status', search: 'select', selectList: {"0":"未审核","1":"通过","2":"拒绝"}, title: '状态'},
                    {width: 200, title: '操作', templet: ea.table.tool,operat: [[{
                            class: 'layui-btn layui-btn-xs layui-btn-success',
                            method: 'request',
                            text: '通过',
                            auth: 'success',
                            url: init.success_url,
                            extend: 'data-full="true"',
                            show: [
                                {"name": "status", "value": "0"}
                            ]
                        }, {
                            class: 'layui-btn layui-btn-xs layui-btn-normal',
                            method: 'request',
                            text: '拒绝',
                            auth: 'error',
                            url: init.error_url,
                            extend: '',
                            show: [
                                {"name": "status", "value": "0"}
                            ]
                        }],'delete']},
                ]],

            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});